home *** CD-ROM | disk | FTP | other *** search
/ Star Trek Starfleet Academy Mini Omnipedia / MINI_OMNI.ISO / pc / omni_v2.dxr / 00402_Construction for Picons.ls < prev    next >
Encoding:
Text File  |  1996-04-15  |  14.4 KB  |  385 lines

  1. global gHoldList, gPiconList, gHoldAtt, gNewAttList
  2.  
  3. on hGetNames aFirstPicon, aLastPicon
  4.   set vL to "a"
  5.   set vLUT to value(field ("LU_" & vL & "_ENCY"))
  6.   repeat with n = aFirstPicon to aLastPicon
  7.     set vName to the name of cast n
  8.     if not (char 1 of vName = vL) then
  9.       set vL to char 1 of vName
  10.       set vLUT to value(field ("LU_" & vL & "_ENCY"))
  11.     end if
  12.     set vSN to char 1 to 6 of vName
  13.     put getaProp(vLUT, vSN)
  14.   end repeat
  15. end
  16.  
  17. on hUpdateAttributesList pPiconBEGIN, pPiconsEND, pMode
  18.   if voidp(pMode) then
  19.     set pMode to #Renew
  20.   end if
  21.   set vBeginShortCastMem to the number of cast "LU_A_ENCY"
  22.   set vEndShortCastMem to the number of cast "LU_Z_ENCY"
  23.   set vEncyBeginCastMem to the number of cast "ATTRIB_A_ENCY"
  24.   set vEncyEndCastMem to the number of cast "ATTRIB_Z_ENCY"
  25.   set vEpisBeginCastMem to the number of cast "ATTRIB_A_EPIS"
  26.   set vEpisEndCastMem to the number of cast "ATTRIB_Z_EPIS"
  27.   set vChroBeginCastMem to the number of cast "ATTRIB_18_CHRO"
  28.   set vChroEndCastMem to the number of cast "ATTRIB_24_CHRO"
  29.   hMakeListFromCast(vBeginShortCastMem, vEndShortCastMem)
  30.   hMakePiconList(pPiconBEGIN, pPiconsEND)
  31.   repeat with vEncyBeginCastMem = vEncyBeginCastMem to vEncyEndCastMem
  32.     set gHoldAtt to hMakeListFromCast(vEncyBeginCastMem, vEncyBeginCastMem)
  33.     hMakeNewAttributes(gHoldAtt, vEncyBeginCastMem, pMode)
  34.   end repeat
  35.   repeat with vEpisBeginCastMem = vEpisBeginCastMem to vEpisEndCastMem
  36.     set gHoldAtt to hMakeListFromCast(vEpisBeginCastMem, vEpisBeginCastMem)
  37.     hMakeNewAttributes(gHoldAtt, vEpisBeginCastMem, pMode)
  38.   end repeat
  39.   repeat with vChroBeginCastMem = vChroBeginCastMem to vChroEndCastMem
  40.     set gHoldAtt to hMakeListFromCast(vChroBeginCastMem, vChroBeginCastMem)
  41.     hMakeNewAttributes(gHoldAtt, vChroBeginCastMem, pMode)
  42.   end repeat
  43. end
  44.  
  45. on hAddVideoToAttrib pBegin, pend
  46.   hputmsg("hfindNameAddtoList BEGINS >")
  47.   set vBeginShortCastMem to the number of cast "LU_A_ENCY"
  48.   set vEndShortCastMem to the number of cast "LU_Z_ENCY"
  49.   set vShortNameList to hMakeListFromCast(vBeginShortCastMem, vEndShortCastMem)
  50.   set vShortNameList to value(vShortNameList)
  51.   repeat with vcastNum = pBegin to pend
  52.     set gHoldList to [:]
  53.     set vList to value(the text of cast vcastNum)
  54.     repeat with x = 1 to count(value(vList))
  55.       set vHoldValue to getAt(vList, x)
  56.       set vHoldProp to getPropAt(vList, x)
  57.       set vHoldLong to vHoldProp & " (TNG)"
  58.       set vHoldshortPos to getPos(vShortNameList, vHoldLong)
  59.       set vHoldshortName to getPropAt(vShortNameList, vHoldshortPos)
  60.       setAt(vHoldValue, 5, vHoldshortName)
  61.       addProp(gHoldList, vHoldProp, vHoldValue)
  62.     end repeat
  63.     set the text of cast vcastNum to string(gHoldList)
  64.     hputmsg("hAddVideoToAttrib > just wrote to castnumber" && vcastNum)
  65.   end repeat
  66. end
  67.  
  68. on hConcatenateLists aList, aNotherList
  69.   put "Starting with" && aList && aNotherList
  70.   set k to count(aNotherList)
  71.   if aList = 0 then
  72.     set aList to []
  73.   end if
  74.   repeat with n = 1 to k
  75.     append(aList, getAt(aNotherList, n))
  76.   end repeat
  77.   return aList
  78. end
  79.  
  80. on hMakeNewAttributes pList, pCastNum, pMode
  81.   hputmsg(">hMakeNewAttributes for pCastNum" && pCastNum)
  82.   set vHoldValue to []
  83.   set gNewAttList to [:]
  84.   set vNewValue to []
  85.   set vMaxPicons to count(gPiconList)
  86.   repeat with p = 1 to count(pList)
  87.     set vHoldValue to getAt(pList, p)
  88.     set vHoldProp to getPropAt(pList, p)
  89.     if pMode = #Renew then
  90.       put "You chose the RENEW option."
  91.       put "Please note that IT, uh, HAS NEVER BEEN TESTED. Check your results carefully."
  92.       set vHoldNumberPicons to 0
  93.       set vNewPiconValueList to 0
  94.       setAt(vHoldValue, 2, vHoldNumberPicons)
  95.       setAt(vHoldValue, 3, vNewPiconValueList)
  96.     else
  97.       if pMode = #add then
  98.         nothing()
  99.       else
  100.         beep()
  101.         hputmsg(">hMakeNewAttributes is confused.")
  102.         abort()
  103.       end if
  104.     end if
  105.     set vIsItThere to getaProp(gPiconList, vHoldProp)
  106.     set vNewPiconValueList to []
  107.     if not voidp(vIsItThere) then
  108.       hputmsg("...checking for picons in" && vHoldProp)
  109.       set vthisPos to getPos(gPiconList, vIsItThere)
  110.       set vCheckProp to getPropAt(gPiconList, vthisPos)
  111.       add(vNewPiconValueList, vIsItThere)
  112.       set vHoldNumberPicons to count(vNewPiconValueList)
  113.       hputmsg("vHoldValue" && vHoldValue)
  114.       if pMode = #add then
  115.         setAt(vHoldValue, 2, getAt(vHoldValue, 2) + vHoldNumberPicons)
  116.       else
  117.         setAt(vHoldValue, 2, vHoldNumberPicons)
  118.       end if
  119.       hputmsg("vHoldNumberPicons is now" && vHoldNumberPicons)
  120.       if pMode = #add then
  121.         setAt(vHoldValue, 3, hConcatenateLists(getAt(vHoldValue, 3), vNewPiconValueList))
  122.       else
  123.         setAt(vHoldValue, 3, vNewPiconValueList)
  124.       end if
  125.       hputmsg("vHoldValue is now" && vHoldValue)
  126.       set vthisPos to vthisPos + 1
  127.       if vthisPos > vMaxPicons then
  128.         set vCheckProp to "NOWAY"
  129.       else
  130.         set vCheckProp to getPropAt(gPiconList, vthisPos)
  131.       end if
  132.     end if
  133.     repeat with xxx = 1 to 4
  134.       if string(vCheckProp) = string(vHoldProp) then
  135.         set vIsItThere to getAt(gPiconList, vthisPos)
  136.         add(vNewPiconValueList, vIsItThere)
  137.         set vHoldNumberPicons to count(vNewPiconValueList)
  138.         setAt(vHoldValue, 2, vHoldNumberPicons)
  139.         setAt(vHoldValue, 3, vNewPiconValueList)
  140.         sort(vNewPiconValueList)
  141.         set vthisPos to vthisPos + 1
  142.         if vthisPos > vMaxPicons then
  143.           set vCheckProp to "NOWAY"
  144.           next repeat
  145.         end if
  146.         set vCheckProp to getPropAt(gPiconList, vthisPos)
  147.       end if
  148.     end repeat
  149.     hputmsg("vHoldValue after last check=" && vHoldValue)
  150.     addProp(gNewAttList, vHoldProp, vHoldValue)
  151.     set vNewPiconValueList to []
  152.   end repeat
  153.   set the text of cast pCastNum to string(gNewAttList)
  154.   hputmsg("hMakeNewAttributes wrote to cast number " && pCastNum)
  155. end
  156.  
  157. on hMakePiconList pBegin, pend
  158.   hputmsg(">hMakePiconList begins...")
  159.   set gPiconList to [:]
  160.   repeat with vCountCastMem = pBegin to pend
  161.     set vHoldProp to the number of cast vCountCastMem
  162.     set vHoldValue to the name of cast vCountCastMem
  163.     set vHoldValue to chars(vHoldValue, 1, 6)
  164.     hputmsg("...cast num" && vHoldProp)
  165.     set vHoldValue to getProp(gHoldList, vHoldValue)
  166.     addProp(gPiconList, vHoldValue, vHoldProp)
  167.   end repeat
  168.   hputmsg("...sorting the currentPicon List Now")
  169.   sort(gPiconList)
  170.   hputmsg("...done.")
  171.   return gPiconList
  172. end
  173.  
  174. on hThisIsAnEpisGuide pList
  175.   set gHoldList to [:]
  176.   hputmsg("hThisIsAnEpisGuide BEGINS > edit out the (TNG) or (TOS)")
  177.   repeat with x = 1 to count(value(pList))
  178.     set vHoldValue to getAt(pList, x)
  179.     set vHoldProp to getPropAt(pList, x)
  180.     set vHoldProp to char 1 to the number of chars in vHoldProp - 6 of vHoldProp
  181.     addProp(gHoldList, vHoldProp, vHoldValue)
  182.   end repeat
  183.   hputmsg("hthisisanepisguide gHoldList" && gHoldList)
  184.   return gHoldList
  185. end
  186.  
  187. on hThisIsAnEpisGuideVal pList
  188.   set gHoldList to [:]
  189.   hputmsg("hThisIsAnEpisGuideVal BEGINS > edit out the (TNG) or (TOS)")
  190.   repeat with x = 1 to count(value(pList))
  191.     set vHoldValue to getAt(pList, x)
  192.     set vHoldValue to char 1 to the number of chars in vHoldValue - 6 of vHoldValue
  193.     set vHoldProp to getPropAt(pList, x)
  194.     addProp(gHoldList, vHoldProp, vHoldValue)
  195.   end repeat
  196.   return gHoldList
  197. end
  198.  
  199. on hUpdateLUtables pList, pTheString, PWriteCastMem
  200.   set gHoldList to [:]
  201.   set pList to value(pList)
  202.   hputmsg("hUpdateLUtables BEGINS > edit out the (TNG) or (TOS)")
  203.   repeat with x = 1 to count(value(pList))
  204.     set vHoldValue to getAt(pList, x)
  205.     set vHoldProp to getPropAt(pList, x)
  206.     set vCountChar to the number of chars in vHoldValue
  207.     set vEpisString to char vCountChar - 4 to vCountChar of vHoldValue
  208.     set vHoldValue to char 1 to vCountChar - 6 of vHoldValue
  209.     if vEpisString = pTheString then
  210.       hputmsg("‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢" && vEpisString)
  211.       addProp(gHoldList, vHoldProp, vHoldValue)
  212.     end if
  213.   end repeat
  214.   set the text of cast PWriteCastMem to string(gHoldList)
  215.   return gHoldList
  216. end
  217.  
  218. on hMakeListFromCast pBegin, pend
  219.   set vCurrentList to [:]
  220.   set gHoldList to [:]
  221.   set vtempList to [:]
  222.   repeat with vCountCastMem = pBegin to pend
  223.     set vCurrentList to the text of cast vCountCastMem
  224.     set vCurrentList to value(vCurrentList)
  225.     repeat with p = 1 to count(vCurrentList)
  226.       set vHoldValue to getAt(vCurrentList, p)
  227.       set vHoldProp to getPropAt(vCurrentList, p)
  228.       addProp(gHoldList, vHoldProp, vHoldValue)
  229.     end repeat
  230.   end repeat
  231.   hputmsg("hMakeListFromCast: Sorting this current attributes list" && pBegin)
  232.   return gHoldList
  233. end
  234.  
  235. on hAddPiconsToEpissub
  236.   set vFixthese to []
  237.   set vOldList to [:]
  238.   set vStartEpisATT to the number of cast "ATTRIB_A_EPIS"
  239.   set vEndEpisATT to the number of cast "ATTRIB_Z_EPIS"
  240.   set vStartSubATT to the number of cast "ATTRIB_1_EPISSUB"
  241.   set vEndSubATT to the number of cast "ATTRIB_5_EPISSUB"
  242.   repeat with x = vStartEpisATT to vEndEpisATT
  243.     set vHoldAttList to value(the text of cast x)
  244.     repeat with p = 1 to count(vHoldAttList)
  245.       set vHoldval to getAt(vHoldAttList, p)
  246.       set vHoldProp to getPropAt(vHoldAttList, p)
  247.       addProp(vOldList, vHoldProp, vHoldval)
  248.     end repeat
  249.   end repeat
  250.   repeat with y = vStartSubATT to vStartSubATT + 2
  251.     set vthisListVal to []
  252.     set vNewSUBlist to [:]
  253.     set vHoldthisSubList to value(the text of cast y)
  254.     repeat with z = 1 to count(vHoldthisSubList)
  255.       set vEntryName to getPropAt(vHoldthisSubList, z)
  256.       set vHoldval to getAt(vHoldthisSubList, z)
  257.       set vHoldEntryName to word 2 to the number of words in vEntryName of vEntryName
  258.       set vTestHere to getaProp(vOldList, vHoldEntryName)
  259.       if voidp(vTestHere) then
  260.         set vHoldEntryName to hChangeTheA(vHoldEntryName)
  261.       end if
  262.       set vthisListVal to value(getaProp(vOldList, vHoldEntryName))
  263.       set vthisListVal to value(vthisListVal)
  264.       if not voidp(vthisListVal) then
  265.         if getAt(vthisListVal, 2) <> 0 then
  266.           set vNumofPicons to getAt(vthisListVal, 2)
  267.           set vListofPicons to getAt(vthisListVal, 3)
  268.           setAt(vHoldval, 2, vNumofPicons)
  269.           setAt(vHoldval, 3, vListofPicons)
  270.         end if
  271.       else
  272.         append(vFixthese, vHoldEntryName)
  273.         hputmsg("          ADDED to list" && vHoldEntryName)
  274.       end if
  275.       addProp(vNewSUBlist, vEntryName, vHoldval)
  276.     end repeat
  277.     set the text of cast y to string(vNewSUBlist)
  278.   end repeat
  279.   repeat with y = vStartSubATT + 3 to vStartSubATT + 4
  280.     set vthisListVal to []
  281.     set vNewSUBlist to [:]
  282.     set vHoldthisSubList to value(the text of cast y)
  283.     repeat with z = 1 to count(vHoldthisSubList)
  284.       set vEntryName to getPropAt(vHoldthisSubList, z)
  285.       set vHoldval to getAt(vHoldthisSubList, z)
  286.       set vHoldEntryName to vEntryName
  287.       set vTestHere to getaProp(vOldList, vHoldEntryName)
  288.       if voidp(vTestHere) then
  289.         set vHoldEntryName to word 2 to the number of words in vEntryName of vEntryName
  290.         set vHoldEntryName to hChangeTheA(vHoldEntryName)
  291.       end if
  292.       set vthisListVal to value(getaProp(vOldList, vHoldEntryName))
  293.       set vthisListVal to value(vthisListVal)
  294.       if not voidp(vthisListVal) then
  295.         if getAt(vthisListVal, 2) <> 0 then
  296.           set vNumofPicons to getAt(vthisListVal, 2)
  297.           set vListofPicons to getAt(vthisListVal, 3)
  298.           setAt(vHoldval, 2, vNumofPicons)
  299.           setAt(vHoldval, 3, vListofPicons)
  300.         end if
  301.       else
  302.         append(vFixthese, vHoldEntryName)
  303.       end if
  304.       addProp(vNewSUBlist, vEntryName, vHoldval)
  305.     end repeat
  306.     set the text of cast y to string(vNewSUBlist)
  307.   end repeat
  308.   put "*** Sorry, these must be done by hand ***"
  309.   put vFixthese
  310. end
  311.  
  312. on hAddAttToEpissubForEpisodeGuides
  313.   set vFixthese to []
  314.   set vOldList to [:]
  315.   set vStartEpisATT to the number of cast "ATTRIB_A_EPIS"
  316.   set vEndEpisATT to the number of cast "ATTRIB_Z_EPIS"
  317.   set vSubATT to the number of cast "ATTRIB_2_EPISSUB"
  318.   repeat with x = vStartEpisATT to vEndEpisATT
  319.     set vHoldAttList to value(the text of cast x)
  320.     repeat with p = 1 to count(vHoldAttList)
  321.       set vHoldval to getAt(vHoldAttList, p)
  322.       set vHoldProp to getPropAt(vHoldAttList, p)
  323.       addProp(vOldList, vHoldProp, vHoldval)
  324.     end repeat
  325.   end repeat
  326.   repeat with y = vSubATT to vSubATT
  327.     set vthisListVal to []
  328.     set vNewSUBlist to [:]
  329.     set vHoldthisSubList to value(the text of cast y)
  330.     repeat with z = 1 to count(vHoldthisSubList)
  331.       set vEntryName to getPropAt(vHoldthisSubList, z)
  332.       set vHoldval to getAt(vHoldthisSubList, z)
  333.       set vHoldEntryName to word 2 to the number of words in vEntryName of vEntryName
  334.       set vthisListVal to value(getaProp(vOldList, vHoldEntryName))
  335.       set vthisListVal to value(vthisListVal)
  336.       if not voidp(vthisListVal) then
  337.         set vNumofPicons to getAt(vthisListVal, 2)
  338.         set vListofPicons to getAt(vthisListVal, 3)
  339.         setAt(vHoldval, 2, vNumofPicons)
  340.         setAt(vHoldval, 3, vListofPicons)
  341.         hputmsg("working on" && z)
  342.         set vTextCastNum to getAt(vthisListVal, 9)
  343.         set vTextItemNum to getAt(vthisListVal, 10)
  344.         setAt(vHoldval, 9, vTextCastNum)
  345.         setAt(vHoldval, 10, vTextItemNum)
  346.         set vVideoRef to getAt(vthisListVal, 5)
  347.         setAt(vHoldval, 5, vVideoRef)
  348.       else
  349.         append(vFixthese, vHoldEntryName)
  350.       end if
  351.       addProp(vNewSUBlist, vEntryName, vHoldval)
  352.     end repeat
  353.     set the text of cast y to string(vNewSUBlist)
  354.   end repeat
  355. end
  356.  
  357. on hChangeTheA pThisEntry
  358.   if word 1 of pThisEntry = "Star" then
  359.     set pThisEntry to " " & pThisEntry
  360.   end if
  361.   if word 1 of pThisEntry = "‚ÄúA" then
  362.     set vFirst to "‚Äú" & word 2 to the number of words in pThisEntry - 2 of pThisEntry
  363.     set vTNGTOS to word the number of words in pThisEntry of pThisEntry
  364.     set vwithQuote to word the number of words in pThisEntry - 1 of pThisEntry
  365.     set vwithOutQuoate to char 1 to the number of chars in vwithQuote - 1 of vwithQuote
  366.     if the number of words in pThisEntry > 3 then
  367.       set pThisEntry to vFirst && vwithOutQuoate & ", A‚Äù" && vTNGTOS
  368.     else
  369.       set pThisEntry to "‚Äú" & vwithOutQuoate & ", A‚Äù" && vTNGTOS
  370.     end if
  371.   end if
  372.   if word 1 of pThisEntry = "‚ÄúThe" then
  373.     set vFirst to "‚Äú" & word 2 to the number of words in pThisEntry - 2 of pThisEntry
  374.     set vTNGTOS to word the number of words in pThisEntry of pThisEntry
  375.     set vwithQuote to word the number of words in pThisEntry - 1 of pThisEntry
  376.     set vwithOutQuoate to char 1 to the number of chars in vwithQuote - 1 of vwithQuote
  377.     if the number of words in pThisEntry > 3 then
  378.       set pThisEntry to vFirst && vwithOutQuoate & ", The‚Äù" && vTNGTOS
  379.     else
  380.       set pThisEntry to "‚Äú" & vwithOutQuoate & ", The‚Äù" && vTNGTOS
  381.     end if
  382.   end if
  383.   return pThisEntry
  384. end
  385.